﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

using System.Data;



public class datLoaiTin
{
    SqlCommand cmd;
    SqlDataReader dr;
    public List<entLoaiTin> getall()
    {
        string constr = System.Configuration.ConfigurationManager.ConnectionStrings["conStr3"].ConnectionString;
        SqlConnection sqlConnection = new SqlConnection(constr);
        sqlConnection.Open();
        cmd = new SqlCommand("sp_LoaiTinGetAll", sqlConnection);
        cmd.CommandType = CommandType.StoredProcedure;
        dr = cmd.ExecuteReader();
        entLoaiTin entsv = new entLoaiTin();
        List<entLoaiTin> lst = new List<entLoaiTin>();
        while (dr.Read())
        {
            entsv = new entLoaiTin();
            entsv.LoaiTinId = int.Parse(dr["LoaiTinID"].ToString());
            entsv.TenLoaiTin = dr["TenLoaiTin"].ToString();
            lst.Add(entsv);
        }
        dr.Close();
        sqlConnection.Close();
        return lst;
    }
}

